<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Docusaurus v2.0.0-alpha.65">
<title data-react-helmet="true">9.19 数据库生成模型 | Fur</title><meta data-react-helmet="true" name="docsearch:version" content="current,latest"><meta data-react-helmet="true" name="twitter:card" content="summary_large_image"><meta data-react-helmet="true" property="og:title" content="9.19 数据库生成模型 | Fur"><meta data-react-helmet="true" name="description" content="9.19.1 数据库开发方式"><meta data-react-helmet="true" property="og:description" content="9.19.1 数据库开发方式"><meta data-react-helmet="true" property="og:url" content="https://chinadot.net/docs/dbcontext-db-first"><link data-react-helmet="true" rel="shortcut icon" href="/img/favicon.ico"><link data-react-helmet="true" rel="canonical" href="https://chinadot.net/docs/dbcontext-db-first"><link rel="stylesheet" href="/styles.8aef5b7b.css">
<link rel="preload" href="/styles.1af3f57f.js" as="script">
<link rel="preload" href="/runtime~main.e2f14afc.js" as="script">
<link rel="preload" href="/main.cb4b4173.js" as="script">
<link rel="preload" href="/1.7bcff63a.js" as="script">
<link rel="preload" href="/2.f71a81b4.js" as="script">
<link rel="preload" href="/01a85c17.755a5885.js" as="script">
<link rel="preload" href="/1be78505.572787d1.js" as="script">
<link rel="preload" href="/6875c492.a75dca0e.js" as="script">
<link rel="preload" href="/a6aa9e1f.005e050b.js" as="script">
<link rel="preload" href="/ccc49370.0b963bc5.js" as="script">
<link rel="preload" href="/ece76bd1.5f0e74a1.js" as="script">
<link rel="preload" href="/86.763e07e0.js" as="script">
<link rel="preload" href="/85.f9b1e033.js" as="script">
<link rel="preload" href="/f976f453.d1d87a8b.js" as="script">
<link rel="preload" href="/17896441.b0924391.js" as="script">
<link rel="preload" href="/902d8112.7b0fbe3a.js" as="script">
</head>
<body>
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><div aria-label="Navigation bar toggle" class="navbar__toggle" role="button" tabindex="0"><svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></div><a class="navbar__brand" href="/"><img class="navbar__logo" src="/img/logo.png" alt="Fur Logo"><strong class="navbar__title">Fur</strong></a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/docs/">Next</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/docs">文档</a><a class="navbar__item navbar__link" href="/blog">博客</a><a target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">配置</a></div><div class="navbar__items navbar__items--right"><a target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">视频</a><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">工具</a><ul class="dropdown__menu"><li><a target="_blank" rel="noopener noreferrer" class="dropdown__link" position="left">代码生成器</a></li></ul></div><a href="https://gitee.com/monksoul/Fur/board" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">看板</a><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">仓库</a><ul class="dropdown__menu"><li><a href="https://gitee.com/monksoul/Fur" target="_blank" rel="noopener noreferrer" class="dropdown__link" position="left">Gitee</a></li><li><a href="https://github.com/MonkSoul/Fur" target="_blank" rel="noopener noreferrer" class="dropdown__link" position="left">GitHub</a></li></ul></div><div class="react-toggle react-toggle--disabled displayOnlyInLargeViewport_2aTZ"><div class="react-toggle-track"><div class="react-toggle-track-check"><span class="toggle_BsTx">🌜</span></div><div class="react-toggle-track-x"><span class="toggle_BsTx">🌞</span></div></div><div class="react-toggle-thumb"></div><input type="checkbox" disabled="" aria-label="Dark mode toggle" class="react-toggle-screenreader-only"></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div><div class="navbar-sidebar"><div class="navbar-sidebar__brand"><a class="navbar__brand" href="/"><img class="navbar__logo" src="/img/logo.png" alt="Fur Logo"><strong class="navbar__title">Fur</strong></a></div><div class="navbar-sidebar__items"><div class="menu"><ul class="menu__list"><li class="menu__list-item"><a target="_blank" rel="noopener noreferrer" class="menu__link">Versions</a></li><li class="menu__list-item"><a aria-current="page" class="menu__link navbar__link--active" href="/docs">文档</a></li><li class="menu__list-item"><a class="menu__link" href="/blog">博客</a></li><li class="menu__list-item"><a target="_blank" rel="noopener noreferrer" class="menu__link">配置</a></li><li class="menu__list-item"><a target="_blank" rel="noopener noreferrer" class="menu__link">视频</a></li><li class="menu__list-item"><a target="_blank" rel="noopener noreferrer" class="menu__link menu__link--sublist">工具</a><ul class="menu__list"><li class="menu__list-item"><a target="_blank" rel="noopener noreferrer" class="menu__link" position="left">代码生成器</a></li></ul></li><li class="menu__list-item"><a href="https://gitee.com/monksoul/Fur/board" target="_blank" rel="noopener noreferrer" class="menu__link">看板</a></li><li class="menu__list-item"><a target="_blank" rel="noopener noreferrer" class="menu__link menu__link--sublist">仓库</a><ul class="menu__list"><li class="menu__list-item"><a href="https://gitee.com/monksoul/Fur" target="_blank" rel="noopener noreferrer" class="menu__link" position="left">Gitee</a></li><li class="menu__list-item"><a href="https://github.com/MonkSoul/Fur" target="_blank" rel="noopener noreferrer" class="menu__link" position="left">GitHub</a></li></ul></li></ul></div></div></div></nav><div class="main-wrapper"><div class="docPage_2gpo"><div class="docSidebarContainer_3_JD" role="complementary"><div class="sidebar_2urC"><div class="menu menu--responsive menu_5FrY"><button aria-label="Open Menu" aria-haspopup="true" class="button button--secondary button--sm menu__button" type="button"><svg aria-label="Menu" class="sidebarMenuIcon_Dm3K" xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 32 32" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><ul class="menu__list"><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">1. 框架介绍</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/">1.1 介绍</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/author">1.2 关于作者</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/source">1.3 源码结构</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/reference">1.4 项目引用</a></li></ul></li><li class="menu__list-item"><a class="menu__link" href="/docs/get-start">2. 一分钟入门</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/appstartup">3. 应用启动</a></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">4. 配置与选项</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/configuration">4.1 配置</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/options">4.2 选项</a></li></ul></li><li class="menu__list-item"><a class="menu__link" href="/docs/dynamic-api-controller">5. 动态 WebAPI</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/specification-document">6. 规范化接口文档</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/friendly-exception">7. 友好异常处理</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/data-validation">8. 数据校验</a></li><li class="menu__list-item"><a class="menu__link menu__link--sublist menu__link--active" href="#!">9. 数据库操作指南</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext">9.1 数据库上下文</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-locator">9.2 数据库上下文定位器</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/entity">9.3 数据库实体</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-repository">9.4 仓储模式</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-add">9.5 新增操作</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-update">9.6 更新操作</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-add-or-update">9.7 新增或更新操作</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-delete">9.8 删除操作</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-batch">9.9 批量操作</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-query">9.10 查询操作</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-hight-query">9.11 高级查询操作</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-view">9.12 视图操作</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-proc">9.13 存储过程操作</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-function">9.14 函数操作</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-sql">9.15 Sql 操作</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-sql-template">9.16 Sql 模板</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-sql-proxy">9.17 Sql 高级代理</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-multi-database">9.18 多数据库操作</a></li><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active active" tabindex="0" href="/docs/dbcontext-db-first">9.19 数据库生成模型</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-code-first">9.20 模型生成数据库</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-seed-data">9.21 实体种子数据</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-audit">9.22 审计日志</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-filter">9.23 实体/全局查询筛选器</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-Interceptor">9.24 数据库操作拦截器</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/tran">9.25 事务和工作单元</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/dbcontext-read-write">9.26 读写分离/主从复制</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/split-db">9.27 分表分库</a></li></ul></li><li class="menu__list-item"><a class="menu__link" href="/docs/saas">10. SaaS 多租户</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/dependency-injection">11. 依赖注入/控制反转</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/object-mapper">12. 对象数据映射</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/cache">13. 分布式缓存</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/auth-control">14. 安全鉴权</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/cors">15. CORS 跨域</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/local-language">16. 多语言处理</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/view-engine">17. 视图引擎</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/event-bus">18. 事件总线</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/logging">19. 日志记录</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/http">20. 网络请求</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/process-service">21. 进程服务</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/job">22. 任务调度</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/signalr">23. 即时通讯</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/grpc">24. Grpc 服务</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/deploy">25. 托管部署</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/devops">26. 持续部署集成</a></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">27. 测试指南</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/unittest">27.1 单元测试</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/performance">27.2 性能测试</a></li></ul></li><li class="menu__list-item"><a class="menu__link" href="/docs/contribute">28. 贡献指南</a></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">29. 常见问题</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/answer">29.1 常见问题</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/errors">29.2 常见错误</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/gooduse">29.3 最佳实践</a></li></ul></li></ul></div></div></div><main class="docMainContainer_3EyW"><div class="container padding-vert--lg docItemWrapper_1EkI"><div class="row"><div class="col docItemCol_2ASc"><div class="docItemContainer_3QWW"><article><header><h1 class="docTitle_1Lrw">9.19 数据库生成模型</h1></header><div class="markdown"><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2cZh" id="9191-数据库开发方式"></a>9.19.1 数据库开发方式<a aria-hidden="true" tabindex="-1" class="hash-link" href="#9191-数据库开发方式" title="Direct link to heading">#</a></h2><p><code>Fur</code> 提供两种主要方法来 <strong>保持实体模型和数据库架构同步</strong>。</p><p>至于我们应该选用哪个方法，请确定你是希望以实体模型为准还是以数据库为准：</p><ul><li><p>如果希望 <strong>以实体模型为准</strong>，请使用正向工程（Code First）。 对实体模型进行更改时，此方法会以增量方式将相应架构更改应用到数据库，以使数据库保持与实体模型兼容。</p></li><li><p>如果希望 <strong>以数据库架构为准</strong>，请使用反向工程（Database First）。 使用此方法，可通过将数据库架构反向工程到实体模型来生成相应的实体类型。</p></li></ul><p>本章节是 <strong>反向工程（Database First）</strong> 的相关内容。</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2cZh" id="9192-操作指南"></a>9.19.2 操作指南<a aria-hidden="true" tabindex="-1" class="hash-link" href="#9192-操作指南" title="Direct link to heading">#</a></h2><div class="admonition admonition-important alert alert--info"><div class="admonition-heading"><h5><span class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="16" viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>操作之前注意事项</h5></div><div class="admonition-content"><p>目前 <code>Fur Tools</code> 生成工具<strong>默认不支持任何数据库</strong>生成，所以如需生成特定数据库的代码，只需要在 <code>Fur.EntityFrameworkCore.Core</code> 安装对应的数据库包即可：</p><p>各个数据库的包可查阅：<a href="/docs/dbcontext-multi-database#91811-%E6%95%B0%E6%8D%AE%E5%BA%93%E6%8F%90%E4%BE%9B%E5%99%A8%E5%AF%B9%E5%BA%94%E5%8C%85">多数据库操作-数据库提供器对应包</a></p><p>另外，只有 <code>SqlServer</code> 数据库支持可视化 <code>GUI</code> 操作，其他的只能命令行操作。</p></div></div><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2cZh" id="91921-打开-程序包管理控制台"></a>9.19.2.1 打开 <code>程序包管理控制台</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#91921-打开-程序包管理控制台" title="Direct link to heading">#</a></h3><p>注意：开始之前先把 <code>Fur.Web.Entry</code> 设为启动项目。</p><img src="/img/dbfirst1.png"><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2cZh" id="91922-切换默认项目"></a>9.19.2.2 切换默认项目<a aria-hidden="true" tabindex="-1" class="hash-link" href="#91922-切换默认项目" title="Direct link to heading">#</a></h3><p>将 <code>程序包管理控制台</code> 默认项目设置为 <code>Fur.Core</code>，如果您是其他名字，则切换对应即可。</p><img src="/img/dbfirst2.png"><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2cZh" id="91923-输入-clips1-命令"></a>9.19.2.3 输入 <code>cli.ps1</code> 命令<a aria-hidden="true" tabindex="-1" class="hash-link" href="#91923-输入-clips1-命令" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_1XEh"><div class="codeBlockContent_1u-d"><button type="button" aria-label="Copy code to clipboard" class="copyButton_10dd">Copy</button><div tabindex="0" class="prism-code language-shell codeBlock_3iAC"><div class="codeBlockLines_b7E3" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token string" style="color:rgb(195, 232, 141)">&quot;../tools/cli.ps1&quot;</span></div></div></div></div></div><div class="admonition admonition-important alert alert--info"><div class="admonition-heading"><h5><span class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="16" viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>关于数据库命名</h5></div><div class="admonition-content"><p>如果需要保持和数据库一模一样的命名，则使用 <code>-UseDatabaseNames</code> 参数指定，如：</p><div class="mdxCodeBlock_1XEh"><div class="codeBlockContent_1u-d"><button type="button" aria-label="Copy code to clipboard" class="copyButton_10dd">Copy</button><div tabindex="0" class="prism-code language-cs codeBlock_3iAC"><div class="codeBlockLines_b7E3" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token plain"> &amp;&quot;../tools/cli.ps1&quot; -UseDatabaseNames</span></div></div></div></div></div></div></div><img src="/img/dbfirst3.png"><div class="admonition admonition-important alert alert--info"><div class="admonition-heading"><h5><span class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="16" viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>等待输入</h5></div><div class="admonition-content"><p>执行上面命令后，此时，<code>Cli</code> 有一个等待输入提示：</p><div class="mdxCodeBlock_1XEh"><div class="codeBlockContent_1u-d"><button type="button" aria-label="Copy code to clipboard" class="copyButton_10dd">Copy</button><div tabindex="0" class="prism-code language-shell codeBlock_3iAC"><div class="codeBlockLines_b7E3" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 请键入操作类型：</span><span class="token punctuation" style="color:rgb(199, 146, 234)">[</span><span class="token plain">G</span><span class="token punctuation" style="color:rgb(199, 146, 234)">]</span><span class="token plain"> 界面操作，</span><span class="token punctuation" style="color:rgb(199, 146, 234)">[</span><span class="token plain">任意字符</span><span class="token punctuation" style="color:rgb(199, 146, 234)">]</span><span class="token plain"> 命令行操作</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 您的输入是:</span></div></div></div></div></div><p><strong>输入大写 <code>G</code> 进入界面操作模式，其他任意字符进入命令行操作模式。</strong></p></div></div><div class="admonition admonition-caution alert alert--warning"><div class="admonition-heading"><h5><span class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"></path></svg></span>注意事项</h5></div><div class="admonition-content"><p>目前只有 <code>Sql Server</code> 数据库才支持 <code>GUI 界面操作模式</code>，其他数据库请使用命令行模式。</p></div></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2cZh" id="9193-界面操作模式"></a>9.19.3 界面操作模式<a aria-hidden="true" tabindex="-1" class="hash-link" href="#9193-界面操作模式" title="Direct link to heading">#</a></h2><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2cZh" id="91931-启动界面操作"></a>9.19.3.1 启动界面操作<a aria-hidden="true" tabindex="-1" class="hash-link" href="#91931-启动界面操作" title="Direct link to heading">#</a></h3><p>当我们输入 <code>G</code> 时，将打开 <code>GUI</code> 界面操作模式，如：</p><img src="/img/dbfirst4.png"><p>这时，<code>Fur Tools</code> 会自动查找所有数据库配置连接字符串的 <code>.json</code> 文件：</p><div class="mdxCodeBlock_1XEh"><div class="codeBlockContent_1u-d"><button type="button" aria-label="Copy code to clipboard" class="copyButton_10dd">Copy</button><div tabindex="0" class="prism-code language-json codeBlock_3iAC"><div class="codeBlockLines_b7E3" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">  </span><span class="token property">&quot;Logging&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;LogLevel&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">      </span><span class="token property">&quot;Default&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;Information&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">      </span><span class="token property">&quot;Microsoft&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;Warning&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">      </span><span class="token property">&quot;Microsoft.Hosting.Lifetime&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;Information&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">      </span><span class="token property">&quot;Microsoft.EntityFrameworkCore&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;Information&quot;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">  </span><span class="token property">&quot;AllowedHosts&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;*&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">  </span><span class="token property">&quot;ConnectionStrings&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line docusaurus-highlight-code-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;DbConnectionString&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;Server=localhost;Database=Fur;User=sa;Password=000000;MultipleActiveResultSets=True;&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span></div><div class="token-line docusaurus-highlight-code-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;Sqlite3ConnectionString&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;Data Source=./Fur.db&quot;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span></div></div></div></div></div><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2cZh" id="91332-加载数据库表"></a>9.13.3.2 加载数据库表<a aria-hidden="true" tabindex="-1" class="hash-link" href="#91332-加载数据库表" title="Direct link to heading">#</a></h3><p>选择连接字符串之后，点击 <code>加载数据库表和视图</code> 按钮加载。</p><img src="/img/dbfirst5.png"><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2cZh" id="91333-选择表或视图生成"></a>9.13.3.3 选择表或视图生成<a aria-hidden="true" tabindex="-1" class="hash-link" href="#91333-选择表或视图生成" title="Direct link to heading">#</a></h3><p>加载表完成后，可以选择您要生成的表或视图，<strong>支持多选</strong></p><img src="/img/dbfirst6.png"><p>点击底部按钮 <code>立即生成</code></p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2cZh" id="91334-选择保存目录"></a>9.13.3.4 选择保存目录<a aria-hidden="true" tabindex="-1" class="hash-link" href="#91334-选择保存目录" title="Direct link to heading">#</a></h3><p>点击 <code>立即生成</code> 按钮后，会弹出实体保存选择目录资源管理器，默认实体只能保存在 <code>Fur.Core</code> 层：</p><img src="/img/dbfirst7.png"><p>点击确定后就可完成所有生成操作。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2cZh" id="91335-生成最终实体代码"></a>9.13.3.5 生成最终实体代码<a aria-hidden="true" tabindex="-1" class="hash-link" href="#91335-生成最终实体代码" title="Direct link to heading">#</a></h3><img src="/img/dbfirst8.png"><p>最终脚本如下：</p><div class="mdxCodeBlock_1XEh"><div class="codeBlockContent_1u-d"><button type="button" aria-label="Copy code to clipboard" class="copyButton_10dd">Copy</button><div tabindex="0" class="prism-code language-shell codeBlock_3iAC"><div class="codeBlockLines_b7E3" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token plain">PM</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token string" style="color:rgb(195, 232, 141)">&quot;../tools/cli.ps1&quot;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// -----------------------------------------------------------------------------</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">//   ______            _______          _</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">//  </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">  ____</span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">          </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">__   __</span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">        </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">//  </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">__ _   _ _ __     </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> ___   ___ </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">___</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">//  </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">  __</span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> &#x27;__</span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">    </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">/ _ </span><span class="token punctuation" style="color:rgb(199, 146, 234)">\</span><span class="token plain"> / _ </span><span class="token punctuation" style="color:rgb(199, 146, 234)">\</span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> / __</span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">//  </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">  </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">_</span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">       </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">_</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">_</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">\</span><span class="token plain">__ </span><span class="token punctuation" style="color:rgb(199, 146, 234)">\</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">//  </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">_</span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">   </span><span class="token punctuation" style="color:rgb(199, 146, 234)">\</span><span class="token plain">__,_</span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">_</span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">       </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">_</span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token punctuation" style="color:rgb(199, 146, 234)">\</span><span class="token plain">___/ </span><span class="token punctuation" style="color:rgb(199, 146, 234)">\</span><span class="token plain">___/</span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">_</span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain">___/</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">//</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// -----------------------------------------------------------------------------</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// Fur 是 .NET </span><span class="token number" style="color:rgb(247, 140, 108)">5</span><span class="token plain"> 平台下企业应用开发最佳实践框架。</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// Copyright © </span><span class="token number" style="color:rgb(247, 140, 108)">2020</span><span class="token plain"> Fur, Baiqian Co.,Ltd.</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">//</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// 框架名称：Fur</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// 框架作者：百小僧</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// 框架版本：1.0.0</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// 源码地址：https://gitee.com/monksoul/Fur</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// 开源协议：Apache-2.0（http://www.apache.org/licenses/LICENSE-2.0）</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// -----------------------------------------------------------------------------</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 启动中</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 启动成功！</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 请键入操作类型：</span><span class="token punctuation" style="color:rgb(199, 146, 234)">[</span><span class="token plain">G</span><span class="token punctuation" style="color:rgb(199, 146, 234)">]</span><span class="token plain"> 界面操作，</span><span class="token punctuation" style="color:rgb(199, 146, 234)">[</span><span class="token plain">任意字符</span><span class="token punctuation" style="color:rgb(199, 146, 234)">]</span><span class="token plain"> 命令行操作</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 您的输入是: G</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 正在加载数据库表和视图</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 加载成功！</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 正在编译解决方案代码</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Build started</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token plain">.</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Build succeeded.</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">For foreign key FK_PersonDetail_Person_PersonId on table dbo.PersonDetail, unable to model the end of the foreign key on principal table dbo.Person. This is usually because the principal table was not included </span><span class="token keyword" style="font-style:italic">in</span><span class="token plain"> the selection set.</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 编译成功！</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 开始生成实体文件</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 正在生成 City.cs 实体代码</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 成功生成 City.cs 实体代码</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// -----------------------------------------------------------------------------</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// 以下代码由 Fur Tools v1.0.0 生成</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// -----------------------------------------------------------------------------</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">using Fur.DatabaseAccessor</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">using Microsoft.EntityFrameworkCore.Metadata.Builders</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">using System</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">using System.Collections.Generic</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic">#nullable disable</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">namespace Fur.Core</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    public partial class City </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">:</span><span class="token plain"> IEntity, IEntityTypeBuilder</span><span class="token operator" style="color:rgb(137, 221, 255)">&lt;</span><span class="token plain">City</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public </span><span class="token function-name function" style="color:rgb(130, 170, 255)">City</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">            InverseParent </span><span class="token operator" style="color:rgb(137, 221, 255)">=</span><span class="token plain"> new HashSet</span><span class="token operator" style="color:rgb(137, 221, 255)">&lt;</span><span class="token plain">City</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public int Id </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public string Name </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public int? ParentId </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public DateTime CreatedTime </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public DateTime? UpdatedTime </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public bool IsDeleted </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public virtual City Parent </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public virtual ICollection</span><span class="token operator" style="color:rgb(137, 221, 255)">&lt;</span><span class="token plain">City</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token plain"> InverseParent </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public void Configure</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">EntityTypeBuilder</span><span class="token operator" style="color:rgb(137, 221, 255)">&lt;</span><span class="token plain">City</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token plain"> entityBuilder, DbContext dbContext, Type dbContextLocator</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">                entityBuilder.HasIndex</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">e </span><span class="token operator" style="color:rgb(137, 221, 255)">=</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token plain"> e.ParentId, </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;IX_City_ParentId&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">                entityBuilder.HasOne</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">d </span><span class="token operator" style="color:rgb(137, 221, 255)">=</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token plain"> d.Parent</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">                    .WithMany</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">p </span><span class="token operator" style="color:rgb(137, 221, 255)">=</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token plain"> p.InverseParent</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">                    .HasForeignKey</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">d </span><span class="token operator" style="color:rgb(137, 221, 255)">=</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token plain"> d.ParentId</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 正在生成 PersonDetail.cs 实体代码</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 成功生成 PersonDetail.cs 实体代码</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// -----------------------------------------------------------------------------</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// 以下代码由 Fur Tools v1.0.0 生成</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// -----------------------------------------------------------------------------</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">using Fur.DatabaseAccessor</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">using Microsoft.EntityFrameworkCore.Metadata.Builders</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">using System</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">using System.Collections.Generic</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic">#nullable disable</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">namespace Fur.Core</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    public partial class PersonDetail </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">:</span><span class="token plain"> IEntity, IEntityTypeBuilder</span><span class="token operator" style="color:rgb(137, 221, 255)">&lt;</span><span class="token plain">PersonDetail</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public int Id </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public string PhoneNumber </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public string Qq </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public int PersonId </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public void Configure</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">EntityTypeBuilder</span><span class="token operator" style="color:rgb(137, 221, 255)">&lt;</span><span class="token plain">PersonDetail</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token plain"> entityBuilder, DbContext dbContext, Type dbContextLocator</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">                entityBuilder.HasIndex</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">e </span><span class="token operator" style="color:rgb(137, 221, 255)">=</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token plain"> e.PersonId, </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;IX_PersonDetail_PersonId&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">                    .IsUnique</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">                entityBuilder.Property</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">e </span><span class="token operator" style="color:rgb(137, 221, 255)">=</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token plain"> e.Qq</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain">.HasColumnName</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token string" style="color:rgb(195, 232, 141)">&quot;QQ&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 正在生成 Post.cs 实体代码</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 成功生成 Post.cs 实体代码</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// -----------------------------------------------------------------------------</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// 以下代码由 Fur Tools v1.0.0 生成</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// -----------------------------------------------------------------------------</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">using Fur.DatabaseAccessor</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">using Microsoft.EntityFrameworkCore.Metadata.Builders</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">using System</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">using System.Collections.Generic</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic">#nullable disable</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">namespace Fur.Core</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    public partial class Post </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">:</span><span class="token plain"> IEntity</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public int Id </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public string Name </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public DateTime CreatedTime </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public DateTime? UpdatedTime </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public bool IsDeleted </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 正在生成 VPerson.cs 实体代码</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token punctuation" style="color:rgb(199, 146, 234)">..</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 成功生成 VPerson.cs 实体代码</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// -----------------------------------------------------------------------------</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// 以下代码由 Fur Tools v1.0.0 生成</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">// -----------------------------------------------------------------------------</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">using Fur.DatabaseAccessor</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">using Microsoft.EntityFrameworkCore.Metadata.Builders</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">using System</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">using System.Collections.Generic</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic">#nullable disable</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">namespace Fur.Core</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    public partial class VPerson </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">:</span><span class="token plain"> IEntity, IEntityTypeBuilder</span><span class="token operator" style="color:rgb(137, 221, 255)">&lt;</span><span class="token plain">VPerson</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public int Id </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public string Name </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public int Age </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public string Address </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> get</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">set</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        public void Configure</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">EntityTypeBuilder</span><span class="token operator" style="color:rgb(137, 221, 255)">&lt;</span><span class="token plain">VPerson</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token plain"> entityBuilder, DbContext dbContext, Type dbContextLocator</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">                entityBuilder.HasNoKey</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">                entityBuilder.ToView</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token string" style="color:rgb(195, 232, 141)">&quot;V_Person&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">                entityBuilder.Property</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">e </span><span class="token operator" style="color:rgb(137, 221, 255)">=</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token plain"> e.Id</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain">.ValueGeneratedOnAdd</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">                entityBuilder.Property</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">e </span><span class="token operator" style="color:rgb(137, 221, 255)">=</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token plain"> e.Name</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain">.HasMaxLength</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token number" style="color:rgb(247, 140, 108)">32</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">Fur Tools v1.0.0 全部实体生成成功！</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">PM</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span></div></div></div></div></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2cZh" id="9134-命令参数配置"></a>9.13.4 命令参数配置<a aria-hidden="true" tabindex="-1" class="hash-link" href="#9134-命令参数配置" title="Direct link to heading">#</a></h2><p><code>Fur Tools Cli</code> 支持多个参数配置，使用方法只需要在命令后面添加即可，如：</p><div class="mdxCodeBlock_1XEh"><div class="codeBlockContent_1u-d"><button type="button" aria-label="Copy code to clipboard" class="copyButton_10dd">Copy</button><div tabindex="0" class="prism-code language-shell codeBlock_3iAC"><div class="codeBlockLines_b7E3" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token string" style="color:rgb(195, 232, 141)">&quot;../tools/cli.ps1&quot;</span><span class="token plain"> -Context 数据库上下文名 -ConnectionName 连接字符串Key</span></div></div></div></div></div><p>支持参数如下：</p><ul><li><code>-Tables</code>：配置要生成的数据库表，数组类型，如果为空，则生成数据库所有表和视图。如：<code>-Tables Person,PersonDetails</code></li><li><code>-Context</code>：配置数据库上下文，默认 <code>FurDbContext</code>，如果有多个数据库上下文，则此参数必须配置</li><li><code>-ConnectionName</code>：配置数据库连接字符串，对于 <code>appsetting.json</code> 中的 <code>Key</code></li><li><code>-OutputDir</code>：生成实体代码输出目录，默认为：<code>./Fur.Core/Entities/</code></li><li><code>-DbProvider</code>：数据库提供器，默认是 <code>Microsoft.EntityFrameworkCore.SqlServer</code>，其他数据库请指定对应程序集<ul><li><code>SqlServer</code>：<code>Microsoft.EntityFrameworkCore.SqlServer</code></li><li><code>Sqlite</code>：<code>Microsoft.EntityFrameworkCore.Sqlite</code></li><li><code>Cosmos</code>：<code>Microsoft.EntityFrameworkCore.Cosmos</code></li><li><code>InMemoryDatabase</code>：<code>Microsoft.EntityFrameworkCore.InMemory</code></li><li><code>MySql</code>：<code>Pomelo.EntityFrameworkCore.MySql</code></li><li><code>PostgreSQL</code>：<code>Npgsql.EntityFrameworkCore.PostgreSQL</code></li><li><code>Oracle</code>：<code>Citms.EntityFrameworkCore.Oracle</code></li><li><code>Dm</code>：<code>Microsoft.EntityFrameworkCore.Dm</code></li></ul></li><li><code>-EntryProject</code>：Web 启用项目层名，默认 <code>Fur.Web.Entry</code></li><li><code>-CoreProject</code>：实体项目层名，默认 <code>Fur.Core</code></li><li><code>-DbContextLocators</code>：多数据库上下文定位器，默认 <code>MasterDbContextLocator</code>，支持多个，如：<code>MasterDbContextLocator,MySqlDbContextLocator</code></li><li><code>-Product</code>：解决方案默认前缀，如 <code>Fur</code></li><li><code>-UseDatabaseNames</code>：是否保持生成和数据库、表一致的名称</li></ul><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2cZh" id="9135-反馈与建议"></a>9.13.5 反馈与建议<a aria-hidden="true" tabindex="-1" class="hash-link" href="#9135-反馈与建议" title="Direct link to heading">#</a></h2><div class="admonition admonition-note alert alert--secondary"><div class="admonition-heading"><h5><span class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="16" viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>与我们交流</h5></div><div class="admonition-content"><p>给 Fur 提 <a href="https://gitee.com/monksoul/Fur/issues/new?issue" target="_blank" rel="noopener noreferrer">Issue</a>。</p></div></div></div></article><div class="margin-vert--xl"><div class="row"><div class="col"><a href="https://gitee.com/monksoul/Fur/tree/main/handbook/docs/dbcontext-db-first.mdx" target="_blank" rel="noreferrer noopener"><svg fill="currentColor" height="1.2em" width="1.2em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 40 40" style="margin-right:0.3em;vertical-align:sub"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div></div></div><div class="margin-vert--lg"><nav class="pagination-nav" aria-label="Blog list page navigation"><div class="pagination-nav__item"><a class="pagination-nav__link" href="/docs/dbcontext-multi-database"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">« 9.18 多数据库操作</div></a></div><div class="pagination-nav__item pagination-nav__item--next"><a class="pagination-nav__link" href="/docs/dbcontext-code-first"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">9.20 模型生成数据库 »</div></a></div></nav></div></div></div><div class="col col--3"><div class="tableOfContents_3SO_"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#9191-数据库开发方式" class="table-of-contents__link">9.19.1 数据库开发方式</a></li><li><a href="#9192-操作指南" class="table-of-contents__link">9.19.2 操作指南</a><ul><li><a href="#91921-打开-程序包管理控制台" class="table-of-contents__link">9.19.2.1 打开 <code>程序包管理控制台</code></a></li><li><a href="#91922-切换默认项目" class="table-of-contents__link">9.19.2.2 切换默认项目</a></li><li><a href="#91923-输入-clips1-命令" class="table-of-contents__link">9.19.2.3 输入 <code>cli.ps1</code> 命令</a></li></ul></li><li><a href="#9193-界面操作模式" class="table-of-contents__link">9.19.3 界面操作模式</a><ul><li><a href="#91931-启动界面操作" class="table-of-contents__link">9.19.3.1 启动界面操作</a></li><li><a href="#91332-加载数据库表" class="table-of-contents__link">9.13.3.2 加载数据库表</a></li><li><a href="#91333-选择表或视图生成" class="table-of-contents__link">9.13.3.3 选择表或视图生成</a></li><li><a href="#91334-选择保存目录" class="table-of-contents__link">9.13.3.4 选择保存目录</a></li><li><a href="#91335-生成最终实体代码" class="table-of-contents__link">9.13.3.5 生成最终实体代码</a></li></ul></li><li><a href="#9134-命令参数配置" class="table-of-contents__link">9.13.4 命令参数配置</a></li><li><a href="#9135-反馈与建议" class="table-of-contents__link">9.13.5 反馈与建议</a></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container"><div class="row footer__links"><div class="col footer__col"><h4 class="footer__title">文档</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/docs">入门</a></li><li class="footer__item"><a class="footer__link-item" href="/docs">指南</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">社区</h4><ul class="footer__items"><li class="footer__item"><a href="https://gitee.com/monksoul/Fur/issues" target="_blank" rel="noopener noreferrer" class="footer__link-item">讨论</a></li><li class="footer__item"><a href="https://gitee.com/monksoul/Fur/board" target="_blank" rel="noopener noreferrer" class="footer__link-item">看板</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">更多</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/blog">博客</a></li><li class="footer__item"><a href="https://gitee.com/monksoul/Fur" target="_blank" rel="noopener noreferrer" class="footer__link-item">仓库</a></li></ul></div></div><div class="text--center"><div>Copyright © 2020 Fur, Baiqian Co.,Ltd.</div></div></div></footer></div>
<script src="/styles.1af3f57f.js"></script>
<script src="/runtime~main.e2f14afc.js"></script>
<script src="/main.cb4b4173.js"></script>
<script src="/1.7bcff63a.js"></script>
<script src="/2.f71a81b4.js"></script>
<script src="/01a85c17.755a5885.js"></script>
<script src="/1be78505.572787d1.js"></script>
<script src="/6875c492.a75dca0e.js"></script>
<script src="/a6aa9e1f.005e050b.js"></script>
<script src="/ccc49370.0b963bc5.js"></script>
<script src="/ece76bd1.5f0e74a1.js"></script>
<script src="/86.763e07e0.js"></script>
<script src="/85.f9b1e033.js"></script>
<script src="/f976f453.d1d87a8b.js"></script>
<script src="/17896441.b0924391.js"></script>
<script src="/902d8112.7b0fbe3a.js"></script>
</body>
</html>